const {resolve} = require('path')
console.log(resolve('./src/components'));

module.exports = {
  chainWebpack: (config) => {
    config.resolve.alias
      .set('@', resolve('./src'))
      .set('components', resolve('./src/components'))
      .set('views', resolve('./src/views'))
      .set('utils', resolve('./src/utils'))
  },
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [resolve(__dirname, './src/global.less')],
    },
  },
  devServer: {
    // port: 8081, // 端口
    proxy: {
      '/api': {
        target: 'http://localhost:8080/',
        // 允许跨域
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/api': '',
        },
      },
    },
  },
}
